import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/home'
    },
    {
      path: '/home',
      name: 'Home',
      component: () => import(/* webpackChunkName: "home" */ '@/views/home.vue'),
      meta: {
        requireAuth: true,
      }
    },
    {
      path: '/login',
      component: () => import(/* webpackChunkName: "login" */ '@/views/loginAndRegister.vue'),
      meta: {
        requireAuth: false
      }
    },
    {
      path: '/user',
      component: () => import(/* webpackChunkName: "user" */ '@/views/user.vue'),
      meta: {
        requireAuth: false
      }
    },
    {
      path: '/:pathMatch(.*)*',
      redirect: '/home'
    },
  ]
})

export default router
